package com.tencent.iov.cowin.befsale.clue.controller.clue;

import com.tencent.iov.cowin.befsale.clue.controller.clue.assembler.ClueCustomerCollectAssembler;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.request.*;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueCustomerCollectResponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueExpirePesponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueFollowHeadResponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueFollowHeadTypeResponse;
import com.tencent.iov.cowin.befsale.clue.domain.clue.po.ClueCustomerCollect;
import com.tencent.iov.cowin.befsale.clue.service.clue.ClueCustomerCollectService;
import com.software.boot.common.entity.Response;
import com.software.boot.common.model.dao.PageRequest;
import com.software.boot.common.model.dao.PageResponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.request.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @Describe: 线索客户宽表管理端_Controller层
 * @author: whp
 * @created: 2021-12-23 14:53:43
 * @version: 1.0
 */
@RestController
@Api(tags = "线索客户宽表管理端Controller")
@RequestMapping(value = "/v1/clueCustomerCollect", produces = MediaType.APPLICATION_JSON_VALUE)
public class ClueCustomerCollectController {
	
	@Autowired
	private ClueCustomerCollectService clueCustomerCollectService;

	/**
	 * 通过ID获取详细信息
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-通过ID获取详细信息接口", httpMethod = "GET", response = Response.class, notes = "get_detail_by_id")
	@RequestMapping(path = "/get_detail_by_id", method = RequestMethod.GET)
	public Response<ClueCustomerCollectResponse> getDetailById(@ApiParam(required = true, value = "对象ID", defaultValue = "1")  @RequestParam("id") Long id) {
		return Response.success(ClueCustomerCollectAssembler.transformPOToResponseVo(clueCustomerCollectService.getDetailById(id), ClueCustomerCollectResponse.class));
	}

	/**
	 * 单条数据插入ClueCustomerCollect
	 * @param request
	 * @return 插入的条数
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-添加信息接口", httpMethod = "POST", response = Response.class, notes = "add")
	@RequestMapping(path = "/add", method = RequestMethod.POST)
	public Response<Long> add(@Valid @RequestBody AddClueCustomerCollectRequest request) {
		return Response.success(clueCustomerCollectService.insert(ClueCustomerCollectAssembler.transformVOToPO(request, ClueCustomerCollect.class)));
	}

	/**
	 * 批量插入ClueCustomerCollect
	 * @param requests
	 * @return 批量插入的条数
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-批量插入ClueCustomerCollect接口", httpMethod = "POST", response = Response.class, notes = "add_batch")
	@RequestMapping(path = "/add_batch", method = RequestMethod.POST)
	public Response<Integer> addBatch(@Valid @RequestBody List<QueryClueCustomerCollectRequest> requests) {
		return Response.success(clueCustomerCollectService.insertBatch(ClueCustomerCollectAssembler.transformPOToResponseVoList(requests, ClueCustomerCollect.class)));
	}

	/**
	 * 通过ID修改信息接口
	 *
	 * @param: request
	 * @return: 修改的条数
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-修改信息接口", httpMethod = "POST", response = Response.class, notes = "update")
	@RequestMapping(path = "/update", method = RequestMethod.POST)
	public Response<Integer> update(@Valid @RequestBody UpdateClueCustomerCollectRequest request) {
		return Response.success(clueCustomerCollectService.update(ClueCustomerCollectAssembler.transformVOToPO(request, ClueCustomerCollect.class)));
	}

	/**
	 * 通过ID删除数据
	 * @param request
	 * @return 删除的条数
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-通过ID删除接口", httpMethod = "POST", response = Response.class, notes = "delete")
	@RequestMapping(path = "/delete", method = RequestMethod.POST)
	public Response<Integer> delete(@Valid @RequestBody DeleteClueCustomerCollectRequest request) {
		return Response.success(clueCustomerCollectService.delete(ClueCustomerCollectAssembler.transformVOToPO(request, ClueCustomerCollect.class)));
	}

	/**
	 * 根据条件查询对象list列表
	 * @param request
	 * @return 查询结果
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
	@RequestMapping(path = "/get_list_by_param", method = RequestMethod.POST)
	public Response<List<ClueCustomerCollectResponse>> getListByParam(@RequestBody QueryClueCustomerCollectRequest request) {
		List<ClueCustomerCollect> responseList = clueCustomerCollectService.getListByParam(ClueCustomerCollectAssembler.transformVOToPO(request, ClueCustomerCollect.class));
		return Response.success(ClueCustomerCollectAssembler.transformPOToResponseVoList(responseList, ClueCustomerCollectResponse.class));
	}

	/**
	 * 根据条件查询对象Page记录
	 * @param request
	 * @return 查询结果
	 */
	@ApiOperation(value = "ClueCustomerCollect管理-根据条件查询对象Page记录接口", httpMethod = "POST", response = Response.class, notes = "get_page_by_param")
	@RequestMapping(value = "/get_page_by_param", method = RequestMethod.POST)
	public Response<PageResponse<ClueCustomerCollectResponse>> getPageByParam(@RequestBody PageRequest<QueryClueCustomerCollectRequest> request) {
		PageResponse<ClueCustomerCollect> clueCustomerCollectPageResponse = clueCustomerCollectService.getPageByParam(ClueCustomerCollectAssembler.transformVOToPOPage(request, ClueCustomerCollect.class));
		return Response.success(ClueCustomerCollectAssembler.transformPOToResponseVoPage(clueCustomerCollectPageResponse, ClueCustomerCollectResponse.class));
	}


	/**
	 * 根据条件查询对象Page记录
	 * @param request
	 * @return 查询结果
	 */
	@ApiOperation(value = "多条件查询对象Page记录接口", httpMethod = "POST", response = Response.class, notes = "get_page_by_param_all")
	@RequestMapping(value = "/get_page_by_param_all", method = RequestMethod.POST)
	public Response<PageResponse<ClueCustomerCollectResponse>> getPageByParamAll(@RequestBody PageRequest<QueryClueCustomerCollectAllRequest> request) {
		PageResponse<ClueCustomerCollect> clueCustomerCollectPageResponse = clueCustomerCollectService.getPageByParamAll(request);
		return Response.success(ClueCustomerCollectAssembler.transformPOToResponseVoPage(clueCustomerCollectPageResponse, ClueCustomerCollectResponse.class));
	}


	/**
	 * 线索跟进列表头部统计显示
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "线索跟进列表头部显示", httpMethod = "POST", response = Response.class, notes = "getHeadContent")
	@RequestMapping(path = "/getHeadContent", method = RequestMethod.POST)
	public Response<ClueFollowHeadResponse> getHeadContent(@Valid @RequestBody QueryClueCustomerCollectAllRequest request) {
		return Response.success(clueCustomerCollectService.getHeadContent(request));
	}

	/**
	 * 线索内容头部统计显示
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "线索跟进列表头部显示", httpMethod = "POST", response = Response.class, notes = "getClueFollowHeadTypeResponse")
	@PostMapping(path = "/getClueFollowHeadTypeResponse")
	public Response<List<ClueFollowHeadTypeResponse>> getClueFollowHeadTypeResponse(@Valid @RequestBody QueryClueCustomerCollectRequest request) {
		return Response.success(clueCustomerCollectService.getClueFollowHeadTypeResponse(ClueCustomerCollectAssembler.transformVOToPO(request, ClueCustomerCollect.class)));
	}


	/**
	 * 线索状态内容头部统计显示
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "线索状态内容头部统计显示", httpMethod = "POST", response = Response.class, notes = "getClueStatusHeadTypeResponse")
	@PostMapping(path = "/getClueStatusHeadTypeResponse")
	public Response<List<ClueFollowHeadTypeResponse>> getClueStatusHeadTypeResponse(@Valid @RequestBody QueryClueCustomerCollectAllRequest request) {
		return Response.success(clueCustomerCollectService.getClueStatusHeadTypeResponse(request));
	}


	/**
	 * 战败审批列表头部统计显示
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "战败审批列表头部统计显示", httpMethod = "POST", response = Response.class, notes = "getClueFailFollowHeadTypeResponse")
	@PostMapping(path = "/getClueFailFollowHeadTypeResponse")
	public Response<List<ClueFollowHeadTypeResponse>> getClueFailFollowHeadTypeResponse(@Valid @RequestBody QueryClueCustomerCollectAllRequest request) {
		return Response.success(clueCustomerCollectService.getClueFailFollowHeadTypeResponse(request));
	}


	/**
	 * 线索分配批列表头部统计显示
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "线索分配批列表头部统计显示", httpMethod = "POST", response = Response.class, notes = "getClueDistributeResponse")
	@PostMapping(path = "/getClueDistributeResponse")
	public Response<List<ClueFollowHeadTypeResponse>> getClueDistributeResponse(@Valid @RequestBody QueryClueCustomerCollectAllRequest request) {
		return Response.success(clueCustomerCollectService.getClueDistributeResponse(request));
	}


	/**
	 * 单条数据查询统计
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@ApiOperation(value = "单条数据查询统计", httpMethod = "GET", response = Response.class, notes = "getClueCustomerCollect")
	@PostMapping(path = "/getClueCustomerCollect")
	public Response<Integer> getClueCustomerCollect(@Valid @RequestBody QueryClueCustomerCollectAllRequest request) {
		return Response.success(clueCustomerCollectService.getClueCustomerCollect(request));
	}

	/**
	 * 总部逾期已跟进or 经销商逾期已跟进
	 * @param request
	 * @return 查询结果
	 */
	@ApiOperation(value = "总部逾期已跟进or 经销商逾期已跟进-根据条件查询对象Page记录接口", httpMethod = "POST", response = Response.class, notes = "getOemOrDealerClueExpireList")
	@RequestMapping(value = "/getOemOrDealerClueExpireList", method = RequestMethod.POST)
	public Response<PageResponse<ClueExpirePesponse>> getOemOrDealerClueExpireList(@RequestBody PageRequest<ClueExpireRequest> request) {
		PageResponse<ClueExpirePesponse> clueCustomerCollectPageResponse = clueCustomerCollectService.getOemOrDealerClueExpireList(request);
		return Response.success(clueCustomerCollectPageResponse);
	}

}